home *** CD-ROM | disk | FTP | other *** search
/ L' Effet Pommier 3 / L'Effet Pommier - Volume 03.iso / Programmation / Gooey1.3.1 / C Templates / ModelessDialog.c < prev    next >
Text File  |  1994-04-14  |  7KB  |  245 lines

  1. $$Loop ModelessDialogs
  2. $$Message User Modeless Dialog, u:$Worksheet.name$.h
  3.  
  4. $$File u:$Worksheet.name$.h
  5. /*  $Worksheet.name$                                 Handle this dialog */
  6. /*  $CopyRight$ */
  7.  
  8. /*    File name:  $Worksheet.name$.h
  9.     Function:  Handle this modeless dialog.
  10.  
  11.     This dialog is called when:
  12.  
  13.     History: $Date$ Original by $Author$
  14.  
  15. */
  16.  
  17. /* ======================================================= */
  18. /* ======================================================= */
  19.  
  20. #ifdef __cplusplus
  21. extern "C" {
  22. #endif
  23.  
  24. /* Init the modeless dialog */
  25. void U_Init_$Worksheet.name$(void);
  26.  
  27. /* Moved the modeless dialog */
  28. void U_Moved_$Worksheet.name$(DialogPtr theDialog, Rect *OldRect);
  29.  
  30. /* Update the modeless dialog */
  31. void U_Update_$Worksheet.name$(DialogPtr theDialog);
  32.  
  33. /* Setup the modeless dialog */
  34. void U_Setup_$Worksheet.name$(DialogPtr theDialog);
  35.  
  36. /* Close the modeless dialog */
  37. void U_Close_$Worksheet.name$(DialogPtr theDialog);
  38.  
  39. /* Hit in the modeless dialog */
  40. void U_Hit_$Worksheet.name$(DialogPtr theDialog, short *itemHit, Boolean *ExitDialog, EventRecord *theEvent);
  41.  
  42. #ifdef __cplusplus
  43. }
  44. #endif
  45.  
  46. /* ======================================================= */
  47. /* ======================================================= */
  48. $$CloseFile
  49. $$Message User Modeless Dialog, u:$Worksheet.name$.c
  50.  
  51. $$File u:$Worksheet.name$.c
  52. /*  $Worksheet.name$                                 Handle this dialog */
  53. /*  $CopyRight$ */
  54.  
  55. /*    File name:  $Worksheet.name$.h
  56.     Function:  Handle this modeless dialog.
  57.  
  58.     This dialog is called when:
  59.  
  60.     History: $Date$ Original by $Author$
  61.  
  62. */
  63.  
  64. #include "mmCommon$Prototype.name$.h"    /* Common */
  65. #include "Common$Prototype.name$.h"        /* Common */
  66.  
  67. #include "$Worksheet.name$.h"
  68.  
  69. /* ======================================================= */
  70. /* ======================================================= */
  71.  
  72. /* Routine: U_Init_$Worksheet.name$ */
  73. /* Purpose: This routine is called while when the program is first run */
  74. /* This is used for onetime initialization */
  75.  
  76. void U_Init_$Worksheet.name$(void)
  77. {
  78.  
  79. }
  80.  
  81. /* ======================================================= */
  82.  
  83. /* Routine: U_Moved_$Worksheet.name$ */
  84. /* Purpose: This routine is called when our window gets moved on the screen, */
  85. /* or to another screen */
  86.  
  87. void U_Moved_$Worksheet.name$(DialogPtr theDialog,Rect *OldRect)
  88. {
  89.  
  90. }
  91.  
  92. /* ======================================================= */
  93.  
  94. /* Routine: U_Update_$Worksheet.name$ */
  95. /* Purpose: This routine is called when our window gets an update event */
  96.  
  97. void U_Update_$Worksheet.name$(DialogPtr theDialog)
  98. {
  99.  
  100. }
  101.  
  102. /* ======================================================= */
  103.  
  104. /* Routine: U_Setup_$Worksheet.name$ */
  105. /* Purpose: This routine is called when our modeless dialog is opened */
  106.  
  107. void U_Setup_$Worksheet.name$(DialogPtr theDialog)
  108. {
  109.  
  110. }
  111.  
  112. /* ======================================================= */
  113.  
  114. /* Routine: U_Close_$Worksheet.name$ */
  115. /* Purpose: This routine is called when our modeless dialog is closed */
  116.  
  117. void U_Close_$Worksheet.name$(DialogPtr theDialog)
  118. {
  119.  
  120. }
  121.  
  122. /* ======================================================= */
  123.  
  124. /* Routine: U_Hit_$Worksheet.name$ */
  125. /* Purpose: Hit in the modeless dialog */
  126.  
  127. void U_Hit_$Worksheet.name$(DialogPtr theDialog,short *itemHit,Boolean *ExitDialog,EventRecord *theEvent)
  128. {
  129. short    DType;                                    /* Type of dialog item */
  130. Handle    DItem;                                    /* Handle to the dialog item */
  131. ControlHandle    CItem;                            /* Control handle */
  132. short    theSelection;                                /* Palette selection */
  133.  
  134.  
  135.     $$Loop Control.type = Button
  136.     $$if Control.Default
  137. /* This is the default selection, when RETURN is pressed. */
  138.     $$endif
  139. if (*itemHit == ResD_$Control.name$)            /* Handle the Button, $Control.FullName$, being pressed */
  140.     {
  141.     }
  142.  
  143.     $$EndLoop Control.type
  144.     $$Loop Control.type = Checkbox
  145. if (*itemHit == ResD_$Control.name$)            /* Handle the checkbox, $Control.FullName$, being pressed */
  146.     {
  147.     }
  148.  
  149.     $$EndLoop
  150.     $$Loop Control.type = Radio
  151. if (*itemHit == ResD_$Control.name$)            /* Handle the radio, $Control.FullName$, being pressed */
  152.     {
  153.     }
  154.  
  155.     $$EndLoop
  156.     $$Loop Control.type = Icon
  157.     $$if Control.NonGraphic
  158. if (*itemHit == ResD_$Control.name$)            /* Handle the Icon, $Control.FullName$, being pressed */
  159.     {
  160.     }
  161.  
  162.     $$endif Control.NonGraphic
  163.     $$EndLoop
  164.     $$Loop Control.type = Picture
  165.     $$if Control.NonGraphic
  166. if (*itemHit == ResD_$Control.name$)            /* Handle the Picture, $Control.FullName$, being pressed */
  167.     {
  168.     }
  169.  
  170.     $$endif Control.NonGraphic
  171.     $$EndLoop
  172.     $$Loop Control.type = UButton
  173. if (*itemHit == ResD_$Control.name$)            /* Handle the user plugin button, $Control.FullName$, being pressed */
  174.     {
  175.     }
  176.  
  177.     $$EndLoop
  178.     $$Loop Control.type = UToggle
  179. if (*itemHit == ResD_$Control.name$)            /* Handle the user plugin toggle, $Control.FullName$, being pressed */
  180.     {
  181.     }
  182.  
  183.     $$EndLoop
  184.     $$Loop Control.type = HotRect
  185.     $$if Control.HotSpot
  186. if (*itemHit == ResD_$Control.name$)            /* Handle the HotSpot, $Control.FullName$, being pressed */
  187.     {
  188.     }
  189.  
  190.     $$endif Control.HotSpot
  191.     $$EndLoop
  192.     $$Loop Control.type = Sicn
  193.     $$if Control.NonGraphic
  194. if (*itemHit == ResD_$Control.name$)            /* Handle the Sicn, $Control.FullName$, being pressed */
  195.     {
  196.     }
  197.  
  198.     $$endif Control.NonGraphic
  199.     $$EndLoop
  200.     $$Loop Control.type = Popup
  201. if (*itemHit == ResD_$Control.name$)            /* Handle the Popup, $Control.FullName$, being pressed */
  202.     {
  203.     GetDItem(theDialog,ResD_$Control.name$,&DType,&DItem,&tempRect);/* Get item information */
  204.     CItem = (ControlHandle)DItem;
  205.     theSelection = GetCtlValue (CItem);            /* Get the Popup selection */
  206.     switch (theSelection)                        /* Select correct item */
  207.         {
  208.         $$Loop PopupItems
  209.         case $Control.PopupID$:                    /* for $Control.PopupName$ */
  210.             break;
  211.         $$EndLoop
  212.  
  213.         default:                                /* allow other buttons, trap for debug */
  214.             break;                                /* end of otherwise */
  215.         }                                        /* end of switch */
  216.     }
  217.  
  218.     $$EndLoop
  219.     $$Loop Control.type = Palette
  220. if (*itemHit == ResD_$Control.name$)            /* Handle the Palette, $Control.FullName$, being pressed */
  221.     {
  222.     GetDItem(theDialog,ResD_$Control.name$,&DType,&DItem,&tempRect);/* Get item information */
  223.     CItem = (ControlHandle)DItem;
  224.     theSelection = GetCtlValue (CItem);            /* Get the Palette selection */
  225.     switch (theSelection)                        /* Select correct item */
  226.         {
  227.         $$Loop PaletteItems
  228.         case $Control.PaletteID$:                /*  Row $Control.Row$, Column $Control.Column$ */
  229.             break;
  230.         $$EndLoop
  231.  
  232.         default:                                /* allow other buttons, trap for debug */
  233.             break;                                /* end of otherwise */
  234.         }                                        /* end of switch */
  235.     }
  236.  
  237.     $$EndLoop
  238.  
  239. }
  240.  
  241. /* ======================================================= */
  242. /* ======================================================= */
  243. $$CloseFile
  244. $$EndLoop
  245.